home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / Quill / Source / DisclosureArrowEditor.cpp < prev    next >
Text File  |  1997-08-09  |  4KB  |  129 lines

  1. /*
  2.  *  File:       DisclosureArrowEditor.cpp
  3.  *  Summary:       A view that knows how to edit a TDisclosureArrow.
  4.  *  Written by: Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1996-1997 Jesse Jones. 
  7.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  8.  *
  9.  *  Change History (most recent first):    
  10.  *
  11.  *         <2>     8/08/97    JDJ        Disclosure arrows no longer support medium and large sizes.
  12.  *         <1>     1/22/96    JDJ        Created
  13.  */
  14.  
  15. #include "DisclosureArrowEditor.h"
  16.  
  17. #include <ZControl.h>
  18.  
  19.  
  20. // ===================================================================================
  21. //    class CEditDisclosureArrowCommand
  22. // ===================================================================================
  23.  
  24. //---------------------------------------------------------------
  25. //
  26. // CEditDisclosureArrowCommand::~CEditDisclosureArrowCommand
  27. //
  28. //---------------------------------------------------------------
  29. CEditDisclosureArrowCommand::~CEditDisclosureArrowCommand()
  30. {
  31. }
  32.  
  33.  
  34. //---------------------------------------------------------------
  35. //
  36. // CEditDisclosureArrowCommand::CEditDisclosureArrowCommand
  37. //
  38. //---------------------------------------------------------------
  39. CEditDisclosureArrowCommand::CEditDisclosureArrowCommand(TDisclosureArrow* pane, const SDisclosureInfo& oldInfo, const SDisclosureInfo& newInfo) : Inherited(pane, oldInfo, newInfo)
  40. {
  41. }
  42.  
  43.  
  44. //---------------------------------------------------------------
  45. //
  46. // CEditDisclosureArrowCommand::UpdatePane
  47. //
  48. //---------------------------------------------------------------
  49. void CEditDisclosureArrowCommand::UpdatePane(const SDisclosureInfo& info)
  50. {
  51.     if (info.isDown)
  52.         mPane->FlipDown();
  53.     else
  54.         mPane->FlipUp();
  55. }
  56.  
  57. #pragma mark -
  58.  
  59. // ===================================================================================
  60. //    CDisclosureArrowEditor
  61. // ===================================================================================
  62.  
  63. static TReanimatorRegister<CDisclosureArrowEditor> sDisclosureArrowEditorRegistrar;
  64.  
  65. //---------------------------------------------------------------
  66. //
  67. // CDisclosureArrowEditor::~CDisclosureArrowEditor
  68. //
  69. //---------------------------------------------------------------
  70. CDisclosureArrowEditor::~CDisclosureArrowEditor()
  71. {
  72. }
  73.  
  74.  
  75. //---------------------------------------------------------------
  76. //
  77. // CDisclosureArrowEditor::CDisclosureArrowEditor
  78. //
  79. //---------------------------------------------------------------
  80. CDisclosureArrowEditor::CDisclosureArrowEditor(TView* superView) : Inherited(superView)
  81. {
  82. }
  83.  
  84.  
  85. //---------------------------------------------------------------
  86. //
  87. // CDisclosureArrowEditor::Create                        [static]
  88. //
  89. //---------------------------------------------------------------
  90. MReanimatable* CDisclosureArrowEditor::Create(MReanimatable* parent)
  91. {
  92.     return new CDisclosureArrowEditor(dynamic_cast<TView*>(parent));
  93. }
  94.  
  95.  
  96. //---------------------------------------------------------------
  97. //
  98. // CDisclosureArrowEditor::GetEditorInfo        
  99. //
  100. //---------------------------------------------------------------
  101. SDisclosureInfo CDisclosureArrowEditor::GetEditorInfo() const
  102. {
  103.     SDisclosureInfo info;
  104.     
  105.     TControl* control = nil;
  106.         
  107.     control = dynamic_cast<TControl*>(this->FindSubPane("Is Down"));
  108.     info.isDown = control->GetValue();
  109.     
  110.     return info;
  111. }
  112.  
  113.  
  114. //---------------------------------------------------------------
  115. //
  116. // CDisclosureArrowEditor::SetEditorInfo
  117. //
  118. //---------------------------------------------------------------
  119. void CDisclosureArrowEditor::SetEditorInfo(const SDisclosureInfo& info)
  120. {
  121.     TControl* control = nil;
  122.     
  123.     control = dynamic_cast<TControl*>(this->FindSubPane("Is Down"));
  124.     control->SetValue(info.isDown);
  125. }
  126.  
  127.  
  128.  
  129.